#!/usr/bin/python
import socket
import os

host="0.0.0.0"
port=9999

sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
sock.bind((host,port))

sock.listen(30)

print("socket is listening on 9999")

def sayhello(conn):
    conn.send("hello,welcome to access my port\n")
    while(True):
        data=conn.recv(1024)
        print("receive new data"+str(data))
        conn.sendall("you said.. "+data)

while(True):
    conn ,addr = sock.accept()

    print("new client %s %d connection accepted!".format(addr[0],addr[1]))
    
    sayhello(conn)
    


sock.close()
